<template>
	<view class="item" @click="handlerToDetail">
		<view class="item-image-wrapper">
			<up-image
				class="item-image"
				width="120rpx"
				height="120rpx"
				radius="16"
				:src="config.baseUrl+item?.pics"
				mode="aspectFill"
			>
				<template #error>
					<view class="image-error">
						<up-icon name="photo" color="#ddd" size="24"></up-icon>
						<text>暂无图片</text>
					</view>
				</template>
			</up-image>
		</view>
		<view class="content">
			<view class="title-wrapper">
				<up-tag
					class="meal-tag"
					text="午餐"
					type="success"
					icon="clock"
					size="mini"
					bgColor="rgba(111, 215, 25, 0.1)"
					color="#6FD719"
					borderColor="transparent"
				></up-tag>
				<text class="combo-name">{{ item.comboName }}</text>
			</view>
			<view class="dish-info">
				<up-icon name="list" color="#999" size="14"></up-icon>
				<text class="dish-name">{{ item.dishName }}</text>
			</view>
			<view class="item-footer">
				<view class="price-info">
					<text class="price-label">营养搭配</text>
				</view>
				<up-icon name="arrow-right" color="#ccc" size="16"></up-icon>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
	import {config} from '../../config/index.js'
	const props = defineProps({
		item: {
			default: {
				id: "",
				pic: "",
				comboName: "",
				dishNames: ""
			}
		}
	})
	
	const handlerToDetail = ()=>{
		uni.navigateTo({
			url:'/pages/comboDetail/comboDetail?id='+props.item.id,
			
		})
	}
</script>

<style lang="scss" scoped>
	.item {
		display: flex;
		align-items: flex-start;
		padding: 30rpx;
		margin: 20rpx 0;
		background:
			linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 251, 252, 0.9) 100%),
			linear-gradient(45deg, rgba(111, 215, 25, 0.05) 0%, rgba(91, 192, 22, 0.03) 100%);
		backdrop-filter: blur(10rpx);
		border-radius: 24rpx;
		box-shadow:
			0 16rpx 48rpx rgba(0, 0, 0, 0.06),
			0 6rpx 24rpx rgba(0, 0, 0, 0.04),
			inset 0 1rpx 0 rgba(255, 255, 255, 0.8);
		border: 2rpx solid rgba(255, 255, 255, 0.4);
		transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
		position: relative;
		overflow: hidden;
		clip-path: polygon(0% 0%, 100% 0%, 98% 100%, 2% 100%);

		&:active {
			transform: scale(0.97) translateY(-2rpx);
			box-shadow:
				0 20rpx 60rpx rgba(0, 0, 0, 0.08),
				0 8rpx 32rpx rgba(0, 0, 0, 0.06);
		}

		&::before {
			content: '';
			position: absolute;
			top: 0;
			left: 0;
			width: 8rpx;
			height: 100%;
			background:
				linear-gradient(135deg, #6FD719 0%, #5BC016 100%),
				linear-gradient(45deg, #4CAF50 0%, #8BC34A 100%);
			background-size: 200% 200%, 150% 150%;
			animation: borderGradient 6s ease infinite;
			clip-path: polygon(0% 0%, 100% 0%, 80% 100%, 0% 100%);
		}

		&::after {
			content: '';
			position: absolute;
			top: 0;
			right: 0;
			bottom: 0;
			left: 0;
			background:
				polygon(0% 0%, 60% 0%, 100% 40%, 100% 100%, 40% 100%, 0% 60%),
				polygon(20% 20%, 80% 0%, 100% 80%, 80% 100%, 0% 80%, 20% 20%);
			background-size: 80% 80%, 60% 60%;
			background-position: 0% 0%, 100% 100%;
			background-repeat: no-repeat;
			opacity: 0.02;
			pointer-events: none;
		}
	}

	@keyframes borderGradient {
		0%, 100% { background-position: 0% 0%, 100% 100%; }
		50% { background-position: 100% 100%, 0% 0%; }
	}

	.item-image-wrapper {
		margin-right: 24rpx;
		position: relative;

		.item-image {
			width: 120rpx;
			height: 120rpx;
			border-radius: 16rpx;
			box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
		}

		.image-error {
			width: 120rpx;
			height: 120rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			background-color: #F5F7FA;
			border-radius: 16rpx;
			gap: 8rpx;

			text {
				font-size: 20rpx;
				color: #999;
			}
		}
	}

	.content {
		flex: 1;
		display: flex;
		flex-direction: column;
		gap: 12rpx;
		min-width: 0;

		.title-wrapper {
			display: flex;
			align-items: center;
			gap: 12rpx;
			margin-bottom: 4rpx;

			.meal-tag {
				flex-shrink: 0;
			}

			.combo-name {
				font-size: 32rpx;
				font-weight: 600;
				color: #333;
				line-height: 1.4;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				flex: 1;
			}
		}

		.dish-info {
			display: flex;
			align-items: center;
			gap: 8rpx;
			margin-bottom: 8rpx;

			.dish-name {
				font-size: 26rpx;
				color: #666;
				line-height: 1.4;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
				flex: 1;
			}
		}

		.item-footer {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: auto;

			.price-info {
				.price-label {
					font-size: 24rpx;
					color: #6FD719;
					background: rgba(111, 215, 25, 0.1);
					padding: 6rpx 12rpx;
					border-radius: 12rpx;
					font-weight: 500;
				}
			}
		}
	}

	/* 动画效果 */
	.item {
		animation: slideInUp 0.4s ease-out;
	}

	@keyframes slideInUp {
		from {
			opacity: 0;
			transform: translateY(20rpx);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}
</style>